package net.web;

import org.htmlparser.Parser;
import org.htmlparser.visitors.ObjectFindingVisitor;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.Node;

public class ParserTest {
  public ParserTest() {
  }

  public static void main(String[] args) {
    try {
      Parser parser = new Parser(
          "http://www.hnedu.cn/cn/index.jsp");
      ObjectFindingVisitor visitorLink = new ObjectFindingVisitor(LinkTag.class);
      parser.visitAllNodesWith(visitorLink);
      Node[] links = visitorLink.getTags();
      for(int i = 0; i < links.length; i++) {
        System.out.println(((Node)links[i]).getText());
      }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}
